package com.wwl.cms.utils.designModeTest.iterator;

import java.util.Iterator;
import java.util.List;

/**
 * @author wwl
 * @version 1.0
 * @date 2021/9/9 19:20
 * @description:
 */
public class InfoCollegeIterator implements Iterator {
    List<Department> departmentList;
    int index = -1;

    public InfoCollegeIterator( List<Department> departmentList){
        this.departmentList = departmentList;
    }

    @Override
    public boolean hasNext() {
        if (index>=departmentList.size()-1){
            return false;
        }else{
            index+=1;
            return true;
        }
    }

    @Override
    public void remove() {

    }

    @Override
    public Object next() {
       return departmentList.get(index);
    }
}
